<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>{$setting.webname} - 修改密码</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="../set//favicon.ico"> <link href="/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="/static/admin/css/animate.css" rel="stylesheet">
    <link href="/static/admin/css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-sm-4">
            <h2>修改密码</h2>
            <ol class="breadcrumb">
                <li>
                    <a href="{:url('Index/admin')}">主页</a>
                </li>
                <li>
                    <strong>修改密码</strong>
                </li>
            </ol>
        </div>
    </div>
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
             <div class="col-sm-12">
			 
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>填写新旧密码保存</h5>
					</div>
                    <div class="ibox-content">
                        <form class="form-horizontal">
						    
                           <div class="form-group">
                                <label class="col-sm-2 control-label">旧密码：</label>
                                <div class="col-sm-4">
                                    <input type="password" placeholder="请输入旧密码" id="oldpassword" class="form-control">
                                </div>
								<div class='col-sm-6'></div>
                            </div>
							<div class="form-group">
                                <label class="col-sm-2 control-label">新密码：</label>
                                <div class="col-sm-4">
                                    <input type="password" placeholder="请输入新密码" id="password" class="form-control">
                                </div>
								<div class='col-sm-6'></div>
                            </div>
							<div class="form-group">
                                <label class="col-sm-2 control-label">确认密码：</label>
                                <div class="col-sm-4">
                                    <input type="password" placeholder="请再次输入密码" id="password2" class="form-control">
                                </div>
								<div class='col-sm-6'></div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-9">
                                    <button class="btn btn-sm btn-info" type="button" id="submit">保 存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
		</div>
	</div>
    <!-- 全局js -->
    <script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/static/admin/js/bootstrap.min.js?v=3.3.6"></script>

    <!-- 自定义js -->
    <script src="/static/admin/js/content.js?v=1.0.0"></script>
    <script src="/static/admin/layui/layui.js"></script>
    <script>
        layui.use('layer', function(){ //独立版的layer无需执行这一句
            var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
            //点击提交
            $("#submit").click(function(){
                if($("#oldpassword").val() == ""){
                    layer.msg("请输入旧密码", {time: 2000});
                }else {
                    if ($("#password").val() == "") {
                        layer.msg("请输入新密码", {time: 2000});
                    } else {
                        if ($("#password2").val() == "") {
                            layer.msg("请再次输入新密码", {time: 2000});
                        } else {
                            if ($("#password").val() == $("#password2").val()) {
                                $.post("{:url('Admins/toSetPassword')}", {
                                    oldpassword: $("#oldpassword").val(),
                                    password: $("#password").val()
                                }, function (data) {
                                    layer.msg(data.msg, {time: 2000}, function () {
                                        if (data.url) {
                                            window.location.href = data.url;
                                        }
                                    });

                                });
                            } else {
                                layer.msg("两次密码不一致", {time: 2000});
                            }
                        }
                    }
                }
            });
        });
    </script>

    
    

</body>

</html>
